#pragma once
#ifndef UTILS_H
#define UTILS_H

#include <sstream>

const double   Pi = 3.14159;

/* Random int between x and y*/
template <class T>
inline T RandBetween(T x,T y)
{
	return rand()% static_cast<int>(y-x+1)+x;
}

template <class N>
std::string NumberToString(N n)
{
	std::stringstream ss;
	ss << n;
	return ss.str();
}

template <class T>
void DeleteSTLContainer(T& c)
{
	typedef typename T::iterator iterator;
	
	for (iterator it = c.begin(); it!=c.end() ; ++it)
	{
		delete *it;
		*it = NULL;
	}
}

template <class map>
inline void DeleteSTLMap(map& m)
{
	typedef typename map::iterator iterator;
	
	for (iterator it = m.begin(); it!=m.end(); ++it)
	{
		delete it->second;
		it->second = NULL;
	}
}

#endif